import Vue from 'vue'
import VueRouter from 'vue-router'
// 1.登录页面声明引入,@是src文件夹后边必须带/
import Login from '@/views/Login'
import Home from '@/views/Home'
import User from '@/views/User'
import Layout from '@/views/Layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'// 默认展示layout
  },
  {
    path: '/login',
    component: Login
  },
  //   ___________________________________
  {
    path: '/layout',
    name: 'layout',
    component: Layout,
    redirect: '/layout/home', // 马上跳转二级路由显示
    children: [
      {
        path: 'home', // 子路由里边不需要/
        component: Home

      },
      {
        path: 'user', // 子路由里边不需要/
        component: User

      }
    ]
  }

]
const router = new VueRouter({
  routes
})

export default router
